import { getInfo, setInfo } from '@/utils/storage'
export default {

  state () {
    return {
      // 个人权证相关
      userInfo: getInfo()
    }
  },
  mutations: {
    setUserInfo (state, newUserInfoObj) {
      state.userInfo = newUserInfoObj
      setInfo(newUserInfoObj)
    }
  },
  getters: {

  },
  actions: {
    loginOut (context) {
      // 个人信息重置
      context.commit('setUserInfo', {})

      // 购物车信息重置(跨模块调用 mutation)
      context.commit('cart/setCartList', [], { root: true })
    }
  }

}
